package com.zhuangwei.dao;

import com.zhuangwei.domain.JpaUser;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author LeviCoder
 * @create 2019-01-29 17:03
 */
@Repository
public interface JpaUserRepository extends JpaRepository<JpaUser,Long>
{

    /**
     * 自定义一个查询，HQL，根据姓名查询
     * @param name
     * @return
     */
    @Query("from JpaUser u where u.name like :name")
    JpaUser findJpaUser(@Param("name") String name);

    JpaUser findJpaUserByName(String name);

    List<JpaUser> findJpaUserById(List<Long> ids);
}
